package org.arch_learn.spring_cloud.sca_homework.service_email_8082.endpoint;

import org.arch_learn.spring_cloud.sca_homework.service_common_dependency.dubbo_api.IEmailDubboService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class EmailEndpoint {
    @Autowired
    private IEmailDubboService emailDubboService;

    @PostMapping(value = "/email/{email}/{code}")
    public ResponseEntity<Boolean> sendEmail(@PathVariable String email,
                                             @PathVariable String code) {
        return ResponseEntity.ok(emailDubboService.sendEmail(email, code));
    }
}
